package auditoryUIbk;

import java.awt.Color;
import java.awt.Component;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;


public class LabelCellRenderer extends JLabel implements ListCellRenderer {
	 static protected ImageIcon images[] = {
		    new ImageIcon("ExperimentVisual/a1.gif"),
		    new ImageIcon("ExperimentVisual/a2.gif"),
		    new ImageIcon("ExperimentVisual/a3.gif"),
		    new ImageIcon("ExperimentVisual/a4.gif"),
		    new ImageIcon("ExperimentVisual/a5.gif"),
		    new ImageIcon("ExperimentVisual/a6.gif"),
		    new ImageIcon("ExperimentVisual/a7.gif"),
		    new ImageIcon("ExperimentVisual/a8.gif")
		  };

		  public LabelCellRenderer() {
		    setOpaque(true);
		  }
		 
		  public Component getListCellRendererComponent(
		               JList list, 
		               Object value, 
		               int index, 
		               boolean isSelected, 
		               boolean cellHasFocus) {
		    setText(value.toString());
		    setIcon(images[index]);
		    setBackground(isSelected ?
		            Color.red : Color.white);
		    setForeground(isSelected ?
		            Color.white : Color.black);
		    return this;
		  }
}
